package twoD.Csg.tests;

import static org.junit.Assert.fail;
import inf.jlinalg.MatrixFormat;
import inf.text.ArrayFormat;

import org.junit.Test;

import twoD.Csg.Rotation;
import twoD.Csg.Transformation;
import twoD.Csg.Translation;

public class TransformationTest {

	@Test
	public void testTransformation() {
		Transformation T = new Transformation();
		System.out.println(MatrixFormat.format(T.getH()));
		Transformation T1 = new Translation(0.1, 0.2);
		System.out.println(MatrixFormat.format(T1.getH()));
		System.out.println(MatrixFormat.format(T1.getH1()));
	}

	@Test
	public void testGetH() {
		Transformation R = new Rotation(0, 0, Math.PI / 3);
		System.out.println(MatrixFormat.format(R.getH()));
		System.out.println(MatrixFormat.format(R.getH1()));
	}

	@Test
	public void testGetH1() {
		fail("Not yet implemented");
	}

	@Test
	public void testMultiply() {
		Transformation T = new Translation(0.1, 0);
		Transformation R = new Rotation(0, 0, Math.PI / 3);
		Transformation T1 = T.multiply(R);
		Transformation T2 = R.multiply(T);
		double[] p = new double[] { 1, 0 };
		double[] p1 = T1.multiply(p);
		double[] p2 = T2.multiply(p);
		System.out.println(ArrayFormat.format(p1));
		System.out.println(ArrayFormat.format(p2));
	}

}
